package com.yeshine.opendata.utils;

import com.yeshine.opendata.core.EntityBase;

import java.util.List;

/**
 * Created by taohj on 2014/7/2.
 */
public class Result<T extends EntityBase> {
    private boolean success;
    private String message;
    private T target;



    private List<T> list;

    private PageResult<T> pageResult;


    public Result() {
        this.success=true;
    }

    public Result(boolean success) {
        this.success = success;
    }

    public Result(boolean success, T target) {
        this.success = success;
        this.target = target;
    }

    public Result(boolean success, List<T> list) {
        this.success = success;
        this.list = list;
    }



    public Result(boolean success, PageResult<T> pageResult) {
        this.success = success;
        this.pageResult = pageResult;
    }


    public Result(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public Result(T target) {
        this.success = true;
        this.target = target;
    }

    public Result(List<T> list) {
        this.success = true;
        this.list = list;
    }



    public Result(PageResult<T> pageResult) {
        this.success = true;
        this.pageResult = pageResult;
    }

    public Result(String message) {
        this.message=message;
        this.success=true;
    }


    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getTarget() {
        return target;
    }

    public void setTarget(T target) {
        this.target = target;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public PageResult<T> getPageResult() {
        return pageResult;
    }

    public void setPageResult(PageResult<T> pageResult) {
        this.pageResult = pageResult;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String toString(){
        return  JsonUtil.toString(this);
    }
}
